package models

import (
	"strconv"
	"time"
)

type Item struct {
	id       string
	Name     string
	Path     string
	Account  string
	PassWord string
}

var (
	Items map[string]*Item
)

func init() {
	Items = make(map[string]*Item)
	// Items["1"] = &Item{"1", "百度", "www.baidu.com", "ubt001", "ubtech"}
	// Items["2"] = &Item{"2", "QQ", "www.qq.com", "ubt001", "ubtech"}
	// Items["3"] = &Item{"3", "网易", "www.163.com", "ubt001", "ubtech"}
}

func AddItem(u Item) {
	u.id = strconv.FormatInt(time.Now().Unix(), 10)
	Items[u.id] = &u
	DbInsert(u)
}

func GetAllI() map[string]*Item {
	return Items
}
